<script setup lang="ts">
  import { ref } from 'vue';

  let title1 = ref();
  let title2 = ref();

  function showInfo(){
    // let input = document.getElementById("username");
    // console.log(input)
    console.log(title1)//RefImpl
    console.log(title1.value)//<input ref="title1" id="username" type="text" value="admin">
    console.log(title1.value.value);//admin

    console.log(title2.value.innerHTML);//h1中的数据
  }
</script>

<template>
    <div class="home">
        <h2>home首页</h2>
        <input ref="title1" type="text" value="admin">
        <h1 ref="title2">h1中的数据</h1>
        <button @click="showInfo">打印dom</button>
    </div>
</template>

<style scoped>
  h2{
    color: cadetblue;
  }
</style>